<?php
include 'D:/dingjiangbbs/common/home.php';
//屏蔽notice错误
error_reporting(E_ALL ^ E_NOTICE);

/**********站点信息部分开始******************/

//接收 post 传过来的值
//var_dump($_POST);

$stitle    = trim($_POST['stitle']);
$url_name  = trim($_POST['url_name']);
$URL 	   = trim($_POST['URL']);
$ICP_info  = trim($_POST['ICP_info']);
$control   = trim($_POST['control']);
//var_dump($URL);

//判断输入数据是否为空
if (!($stitle && $url_name && $URL && $ICP_info)) {
	exit('所有的输入框均不得为空');
}

//根据上述数据修改数据库的数据(该表只有一条记录)
$table  = DB_TABLE_SITE;
$data   = [
	'stitle'   => "$stitle",
	'url_name' => "$url_name",
	'URL'      => "$URL",
	'ICP'      => "$ICP_info",
	'control'  => "$control",
	'addtime'  => time()
];
$where = "sid=8";
$res_site = update($link,$table,$data,$where);
//var_dump($res_site);

//输出
if (!$res_site) {
	exit('<a href="'.WEB_SITE.'admin_cg.php?bighead=1&cg_number=1">修改失败</a>');
}
echo '<a href="'.WEB_SITE.'admin_cg.php?bighead=1&cg_number=1">修改成功</a>';
/*****************优化显示的判断条件****************/	
/*
if ($control == 0 ) {
	//根据post数据修改数据库数据
	$res_site1 = insert($link,$table,$data);
	var_dump($res_site1);
	echo 11111;
}
if ($control == 1) {
	//根据上述数据修改数据库的数据
	$where = "stitle='$stitle' and control=0";
	$res_site2 = update($link,$table,$data,$where);
	var_dump($res_site2);
	echo 2222;
}
*/
/********************************************/


/**********站点信息部分结束******************/
